Configure the development board's boot mode to SD card boot, and insert the TF card into the card slot.
Connect the PS_NET Ethernet port on the development board to the local area network where the development environment is located, or directly connect it to the computer host using an Ethernet cable.
Connect the PS_UART serial port of the development board to the host, and power on the board.
We can see the board's startup information on the corresponding serial port through the host's serial debugging assistant:
By modifying the project-spec/configs/init-ifupdown/interfaces file, the IP in /etc/network/interfaces packaged into the file system becomes a static IP.
x
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interfaceauto loiface lo inet loopback
# Wireless interfacesiface wlan0 inet dhcp wireless_mode managed wireless_essid any wpa-driver wext wpa-conf /etc/wpa_supplicant.conf
iface atml0 inet dhcp
# Wired or wireless interfacesauto eth0/*********Modified Section***********/#iface eth0 inet dhcpiface eth0 inet static address 192.168.3.182 netmask 255.255.255.0 gateway 192.168.3.1 dns-nameservers 8.8.8.8
auto eth1iface eth1 inet dhcp
# Ethernet/RNDIS gadget (g_ether)# ... or on host side, usbnet and random hwaddriface usb0 inet static address 192.168.7.2 netmask 255.255.255.0 network 192.168.7.0 gateway 192.168.7.1
# Bluetooth networkingiface bnep0 inet dhcpThere are two methods to change the IP address to a static IP: one is to set it as a static IP when packaging with petalinux into the file system, and the other is to modify it after the system starts up.
The PS_NET Ethernet port on the development board corresponds to eth0, and the PL_NET Ethernet port corresponds to eth1.
The default IP allocation method for eth0 is DHCP. If you want a fixed IP address, you can edit the /etc/network/interfaces file through the console serial port corresponding to PS_UART to configure the network port as a static IP address. This way, you can later log in to the development board via telnet.
xxxxxxxxxxroot@petalinux-mind:~# vi /etc/network/interfacesConfigure eth0 with the desired IP address. Here it is configured as 192.168.3.184.
xxxxxxxxxx# Wired or wireless interfacesauto eth0#iface eth0 inet dhcpiface eth0 inet static address 192.168.3.184 netmask 255.255.255.0 gateway 192.168.3.1 dns-nameservers 8.8.8.8
To facilitate file transfer and login between the host and the development board, you can enable the FTP and telnet functions on the development board.
To enable the FTP server function on the development board, you need to enable the -w option during Busybox Configuration:
xxxxxxxxxx petalinux-config -c busybox -> Networking utilities -> ftpd -> [*] Enable -w optionOn the computer, use FileZilla software to connect to the development board's FTP server. If the -w option is not enabled, an error will occur.
There are also two ways to enable telnet and FTP functions: one is to modify the corresponding configuration to the desired settings when packaging into the file system; the other is to modify the configuration files after the system starts.
If the project-spec/meta-user/recipes-core/busybox directory does not have the busybox_%.bbappend file and the busybox folder as shown in the figure below, you need to create the busybox_%.bbappend file and the busybox folder, and create the document inetd.conf in the busybox folder.
The content of inetd.conf is as follows:
xxxxxxxxxx#/etc/inetd.conf: see inetd(8) for further informations.## Internet server configuration database## If you want to disable an entry so it isn't touched during# package updates just comment it out with a single '#' character.## <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>##:INTERNAL: Internal services#echo stream tcp nowait root internal#echo dgram udp wait root internal#chargen stream tcp nowait root internal#chargen dgram udp wait root internal#discard stream tcp nowait root internal#discard dgram udp wait root internal#daytime stream tcp nowait root internal#daytime dgram udp wait root internal#time stream tcp nowait root internal#time dgram udp wait root internaltelnet stream tcp nowait root telnetd telnetd -iftp stream tcp nowait root ftpd ftpd -w If the busybox_%.bbappend file already exists, add the following content to this file:
xxxxxxxxxxdo_install_append() { if [ -f ${D}${sysconfdir}/inetd.conf ]; then mv ${D}${sysconfdir}/inetd.conf ${D}${sysconfdir}/inetd.conf.bak fi
install -m 0644 ${WORKDIR}/inetd.conf ${D}${sysconfdir}/inetd.conf}If there is no busybox_%.bbappend file, create a busybox_%.bbappend document with the following content:
xxxxxxxxxxSRC_URI += ""
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
do_install_append() { # bakup origin inetd.conf if [ -f ${D}${sysconfdir}/inetd.conf ]; then mv ${D}${sysconfdir}/inetd.conf ${D}${sysconfdir}/inetd.conf.bak fi
# install new inetd.conf install -m 0644 ${WORKDIR}/inetd.conf ${D}${sysconfdir}/inetd.conf}Then proceed with build and package using petalinux.
After the system starts, you can edit the /etc/inetd.conf file through the console serial port.
xxxxxxxxxxroot@petalinux-mind:~# vi /etc/inetd.confChange the last two lines to the following content:
xxxxxxxxxx#/etc/inetd.conf: see inetd(8) for further informations.## Internet server configuration database## If you want to disable an entry so it isn't touched during# package updates just comment it out with a single '#' character.## <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>##:INTERNAL: Internal services#echo stream tcp nowait root internal#echo dgram udp wait root internal#chargen stream tcp nowait root internal#chargen dgram udp wait root internal#discard stream tcp nowait root internal#discard dgram udp wait root internal#daytime stream tcp nowait root internal#daytime dgram udp wait root internal#time stream tcp nowait root internal#time dgram udp wait root internaltelnet stream tcp nowait root telnetd telnetd -iftp stream tcp nowait root ftpd ftpd -w
After the development board is powered on and the network connection is normal, open the command prompt on the computer and enter telnet 192.168.3.184 to access the development board. If prompted for a username and password, the default username and password are both root. You can also use an FTP tool to upload files to or download files from the development board.
On the console serial port, enter the "ifconfig" command to view the IP: IP address: 192.168.3.184
xxxxxxxxxxifconfigPing from the host can communicate normally. This indicates that the network is functioning properly. TODO: Replace with a screenshot of pinging 192.168.3.184.
The Ethernet port corresponding to PL_NET is eth1. You can set the IP of eth1 using the command "ifconfig eth1 +IP address":
xxxxxxxxxxifconfig eth1 192.168.3.185However, eth1 cannot be pinged at this time. This is because the two network ports on the development board are configured on the same subnet, and the system routes by default through eth0. Therefore, to ping eth1, you must first disconnect the connection of network port 0 and enable network port 1 using commands, or configure eth1 to a different subnet.
xxxxxxxxxxifconfig eth0 downifup eth1Now it can be pinged: